#ifndef __BPFPI82__
#define __BPFPI82__

#define RECURSION 0
#define NORECURSION 1
class BPFPI82{
public:
#if RECURSION
	static int func(int m, int n){
		if(m == 1) return n;
		if(n == 1) return m;
		return func(m-1, n) + func(m,n-1);
	}
#endif
#if NORECURSION
	static int func(int m, int n){
	int** arrs = new int*[n];
	assert(NULL != arrs);
	for(int i = 0; i < n ;++i){
		arrs[i] = new int[m];
		assert(NULL != arrs[i]);
	}

	for(int i = 0; i< m; ++i){
		arrs[0][i] = i+1;
	}
	for(int i = 0; i< n ; ++i){
		arrs[i][0] = i+1;
	}

	for(int i = 1; i< n; ++i){
		for(int j = 1; j< m; ++j){
			arrs[i][j] = arrs[i-1][j] + arrs[i][j-1];
		}
	}
	int answer = arrs[n-1][m-1];
	for(int i = 0 ;i < n; ++i){
		delete []  arrs[i];
	}
	delete [] arrs;	
	return answer;
}
#endif
};
#endif